﻿using BCEntity.Common.News.NewsContentComment;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace BCData.Common.News.NewsContentComment
{
    /// <summary>
    /// 新闻文章评论数据处理
    /// </summary>
    public interface INewsContentCommentData
    {
        /// <summary>
		/// 是否存在该记录
		/// </summary>
		/// <param name="newsContentCommentId">新闻内容评论Id</param>
		Task<bool> Exists(long newsContentCommentId);
        /// <summary>
        /// 添加文章评论
        /// </summary>
        /// <param name="entity">文章评论</param>
        /// <returns></returns>
        NewsContentCommentEntity Add(NewsContentCommentEntity entity);
        /// <summary>
        /// 获取评论数据（分页）
        /// </summary>
        /// <param name="newsContentId">新闻Id</param>
        /// <param name="userId">用户Id</param>
        /// <param name="pageIndex">当前页码</param>
        /// <param name="pageSize">每页数据条数</param>
        /// <param name="dataCount">数据总数</param>
        /// <returns></returns>
        IEnumerable<NewsContentCommentEntity> GetPageableList(long newsContentId, int? userId, int pageIndex, int pageSize, out int dataCount);
        /// <summary>
        /// 获取新闻评论
        /// </summary>
        /// <param name="newsContentCommentId">新闻评论Id</param>
        /// <returns></returns>
        NewsContentCommentEntity Get(long newsContentCommentId);
        /// <summary>
        /// 获取子级评论回复
        /// </summary>
        /// <param name="newsContentId"></param>
        /// <param name="newsContentCommentId"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="dataCount"></param>
        /// <returns></returns>
        IEnumerable<NewsContentCommentEntity> GetChildrenCommentByCommentId(long newsContentId, long newsContentCommentId, int pageIndex, int pageSize, out int dataCount);
        /// <summary>
        /// 获取新闻评论列表
        /// </summary>
        /// <param name="newsContentId">新闻内容Id</param>
        /// <returns></returns>
        IEnumerable<NewsContentCommentEntity> GetNewsContentCommentByNewsContentId(long newsContentId);
        /// <summary>
        /// 删除新闻评论
        /// </summary>
        /// <param name="newsContentId">新闻评论Id</param>
        /// <returns></returns>
        bool DeleteNewsContentCommentByNewsContentId(long newsContentId);
        /// <summary>
        /// 修改新闻评论点赞数量
        /// </summary>
        /// <param name="newsContentCommentId">新闻评论Id</param>
        /// <param name="isAdd">增加或减少</param>
        NewsContentCommentEntity UpdateCommentLikeCount(long newsContentCommentId,bool isAdd);
        /// <summary>
        /// 获取所有新闻内容评论列表（分页）
        /// </summary>
        /// <param name="title">文章标题</param>
        /// <param name="comment">文章评论</param>
        /// <param name="start">开始时间</param>
        /// <param name="end">结束时间</param>
        /// <param name="dataCount">总页数</param>
        /// <param name="ascending">排序</param>
        /// <param name="pageIndex">当前页</param>
        /// <param name="pageSize">每页条数</param>
        /// <returns></returns>
        IEnumerable<NewsContentCommentEntity> GetAllNewsContentComments(string title, string comment, DateTime? start, DateTime? end, out int dataCount, bool? ascending, int pageIndex, int pageSize);
        /// <summary>
        /// 删除新闻评论
        /// </summary>
        /// <param name="newsContentCommentId">新闻评论Id</param>
        void Delete(long newsContentCommentId);

        /// <summary>
        /// 分页获取新闻所有评论列表
        /// </summary>
        /// <param name="pageIndex">当前页</param>
        /// <param name="pageSize">每页条数</param>
        /// <param name="dataCount">总页数</param>
        /// <returns></returns>
        IEnumerable<NewsContentCommentEntity> GetPageableListNewsContentComments(long newsContentId, int? userId, int pageIndex, int pageSize, out int dataCount);

        /// <summary>
		/// 启用新闻内容评论
		/// </summary>
		/// <param name="newsContentCommentId">新闻内容评论Id</param>
		Task<bool> Enabled(long newsContentCommentId);
        /// <summary>
        /// 禁用新闻内容评论
        /// </summary>
        /// <param name="newsContentCommentId">新闻内容评论Id</param>
        Task<bool> Disabled(long newsContentCommentId);
    }
}
